package com.dctp.common.vo;


public class JsonResult {

	private String status;
	private String message;
	private Object data;

	public String getStatus() {
		return status;
	}

	public JsonResult status(String status) {
		this.status = status;
		return this;
	}


	public static final JsonResult success() {
		return new JsonResult().status(TipCode.SUCCESS);
	}

	public static final JsonResult successWithCode(String code) {
		return new JsonResult().status(TipCode.SUCCESS).show("");
	}

	public static final JsonResult successWithData(Object data) {
		return new JsonResult().status(TipCode.SUCCESS).data(data);
	}

	public static final JsonResult failWithMessage(String message) {
		return new JsonResult().status("-1").show(message);
	}

	public static final JsonResult fail(String tipCode) {
		return new JsonResult().status(tipCode);
	}

	public String getMessage() {
		return message;
	}

	public JsonResult show(String message) {
		this.message = message;
		return this;
	}

	public Object getData() {
		return data;
	}

	public JsonResult data(Object data) {
		this.data = data;
		return this;
	}

	@Override
	public String toString() {
		return "JsonResult [status=" + status + ", message=" + message
				+ ", data=" + data + "]";
	}
}
